package org.linlinjava.litemall.admin.web2;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.linlinjava.litemall.db.domain.LitemallAdmin;

public class BaseController {

    public LitemallAdmin currentAdmin() {
        Subject currentUser = SecurityUtils.getSubject();
        Object principal = currentUser.getPrincipal();
        return (LitemallAdmin) principal;
    }

    public Integer getCurrentShopId() {
        LitemallAdmin admin = currentAdmin();
        if (admin == null)
            return 0;
        return admin.getShopId();
    }
}
